package com.activeMQ.listener;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

/**
 * @Description ActiveMQ 监听器
 *
 * @author 堆堆堆
 * @date 2018年4月17日 下午12:20:33
 */
@Component
public class ActiveMQListener {

	/**
	* @Description 监听 queue1 消息
	*
	* @param text
	*/
	@JmsListener(destination = "queue1")
	public void receiveQueue1Msg(String text) {
		System.out.println("<<<<<<============== 收到 queue1 消息：" + text);
	}

	/**
	* @Description 监听 queue2 消息
	*
	* @param text
	*/
	@JmsListener(destination = "queue2")
	public void receiveQueue2Msg(String text) {
		System.out.println("<<<<<<============== 收到 queue2 消息：" + text);
	}

	/**
	 * @Description 监听 topic1 消息
	 *
	 * @param text
	 */
	@JmsListener(destination = "topic1", containerFactory = "jmsContainerFactory")
	public void receiveTopic1Msg(String text) {
		System.out.println("<<<<<<============== 收到 topic1 消息：" + text);
	}

	/**
	 * @Description 监听 topic2 消息
	 *
	 * @param text
	 */
	@JmsListener(destination = "topic2", containerFactory = "jmsContainerFactory")
	public void receiveTopic2Msg(String text) {
		System.out.println("<<<<<<============== 收到 topic2 消息：" + text);
	}
}
